<template>
	<view class="12">
		<page-meta>
		  <navigation-bar
		    title="自定义标题"
		    :loading="true"
		    front-color="orange"
		    background-color="blue"
		    :color-animation-duration="2000"
		    color-animation-timing-func="easeIn"
		  />
		</page-meta>
		<button @click="handleLogin">登录</button>
	</view>
</template>

<script>
	import request from "@/core/request.js";
	export default {
		data(){
			return {
				
			}
		},
		
		methods:{
			async handleLogin(){
				let { code }= await wx.login();
				console.log(code)
				await wx.request({
					// baseUrl:'https://api.weixin.qq.com',
					url:'https://api.weixin.qq.com/sns/jscode2session',
					data:{
						appid:'wxd5343f766ddd13e2',
						secret:'e3dfd8f997ebc07be2f5d980fb932511',
						js_code:code,
						grant_type:'authorization_code'
					},
					success(res){
						let { openid, session_key } = res.data;
						console.log(res.data)
					}
				})
				
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>